package bupt.xixi.learning.context.support;

import bupt.xixi.learning.beans.factory.support.DefaultListableBeanFactory;
import bupt.xixi.learning.beans.factory.xml.XmlBeanDefinitionReader;
import bupt.xixi.learning.context.support.AbstractRefreshableApplicationContext;

public abstract class AbstractXmlApplicationContext extends AbstractRefreshableApplicationContext {

    @Override
    protected void loadBeanDefinitions(final DefaultListableBeanFactory beanFactory) {
        final XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(beanFactory, this);
        String[] locations = getConfigLocations();
        if (null != locations) {
            xmlReader.loadBeanDefinitions(locations);
        }
    }

    protected abstract String[] getConfigLocations();
}